`

The full list of environment variables can be found at

https://www.gnu.org/software/bash/manual/html_node/Bash-

Variables.html.

Running Linux Commands

The bash scripts you’ll write in this book will run common Linux

tools, so if you’re not yet familiar with command line navigation and

file-modification utilities such as cd, ls, chmod, mkdir, and

touch, try exploring them using the man (manual) command. You

can insert it before any Linux command to open a terminal-based

guide on how to use it and what options it offers, as shown in Listing

1-2.

$ man ls

NAME

ls - list directory contents

SYNOPSIS

ls [OPTION]... [FILE]...

DESCRIPTION

List information about the FILEs (the current directory by default).

Sort entries alphabetically if none of -cftuvSUX nor

--sort is specified.

Mandatory arguments to long options are mandatory for short options too.

-a, --all

do not ignore entries starting with .

--snip--

Listing 1-2

The manual page of the ls command

Linux commands can accept many types of input on the

command line. For example, you can enter ls without any

arguments to see files and directories, or pass it arguments to, for

instance, display the list of files all on one line.

Arguments are passed on the command line using either short

form or long form argument syntax, depending on the command in

use. Short-form syntax uses a single dash (-) followed by one or

more characters. The following example uses ls to list files and

directories using a short-form argument syntax:

$ ls -l

Some commands let you supply multiple arguments by

separating the individual arguments or joining them together:

Black Hat Bash (Early Access) © 2023 by Dolev Farhi and Nick Aleks